package com.by.course.controller.student;

import com.by.course.entity.base.BaseResult;
import com.by.course.entity.base.PageResult;
import com.by.course.entity.vo.appointment.req.AddBaseAppointmentVO;
import com.by.course.entity.vo.appointment.req.GetBaseAppointmentVO;
import com.by.course.entity.vo.appointment.req.UpdateBaseAppointmentVO;
import com.by.course.entity.vo.appointment.resp.BaseAppointmentResultVO;
import com.by.course.entity.vo.lessonreview.req.GetBaseLessonReviewVO;
import com.by.course.entity.vo.lessonreview.resp.BaseLessonReviewResultVO;
import com.by.course.entity.vo.schedule.req.GetBaseScheduleVO;
import com.by.course.entity.vo.schedule.resp.BaseScheduleResultVO;
import com.by.course.manage.BaseCourseManager;
import com.by.course.mapper.BaseCourseMapper;
import com.by.course.serivce.BaseAppointmentService;
import com.by.course.serivce.BaseLessonReviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/student")
@Api(tags = "学生接口")
public class StudentController {

    @Resource
    private BaseAppointmentService baseAppointmentService;

    @Resource
    private BaseLessonReviewService baseLessonReviewService;

    @Resource
    private BaseCourseManager baseCourseManager;

    @ApiOperation("预约管理--查询老师的排课信息")
    @PostMapping("/getScheduleByStudentId")
    public BaseResult<BaseScheduleResultVO> getScheduleByStudentId(@RequestBody GetBaseScheduleVO vo) {
        return baseCourseManager.getScheduleByStudentId(vo);
    }

    @ApiOperation("预约管理--学生预约（预约和取消预约）")
    @PostMapping("/createAppointment")
    public BaseResult<String> createAppointment(@RequestBody AddBaseAppointmentVO vo) {
        return baseAppointmentService.createAppointment(vo);
    }

    @ApiOperation("预约管理--查看我的预约")
    @PostMapping("/getAppointmentByUserId")
    public BaseResult<List<BaseAppointmentResultVO>> getAppointmentByUserId(@RequestBody GetBaseAppointmentVO vo) {
        return baseAppointmentService.getAppointmentByUserId(vo);
    }
//
//    @ApiOperation("预约管理--更新我的预约")
//    @PostMapping("/updateAppointment")
//    public BaseResult<String> updateAppointment(@RequestBody List<UpdateBaseAppointmentVO> vo) {
//        return baseAppointmentService.updateAppointment(vo);
//    }

    @ApiOperation("评论管理--学生查看评论信息")
    @PostMapping("/getEvaluateByStudent")
    public BaseResult<List<BaseLessonReviewResultVO>> getEvaluateByStudent(@RequestBody GetBaseLessonReviewVO vo) {
        return baseLessonReviewService.queryLessonReview(vo);
    }
}
